home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / Draw / Sources / DrwDDCmd.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  3.6 KB  |  129 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                DrwDDCmd.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Author:                Mary Boetcher
  7. //
  8. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #ifndef DRWDDCMD_H
  13. #define DRWDDCMD_H
  14.  
  15. // ----- FrameWork Includes -----
  16.  
  17. #ifndef FWDRCMD_H
  18. #include "FWDrCmd.h"
  19. #endif
  20.  
  21. //========================================================================================
  22. //    Forward Declarations
  23. //========================================================================================
  24.  
  25. class CDrawPart;
  26. class CDrawSelection;
  27. class CDrawSubscribeLink;
  28. class CDrawLinkManager;
  29. class CBaseShape;
  30. class CDrawContent;
  31. class CDrawPublishLinkCollection;
  32. class CDrawUndoContent;
  33.  
  34. //========================================================================================
  35. // class CDrawDragCommand - for dragging
  36. //========================================================================================
  37.  
  38. class CDrawDragCommand : public FW_CDragCommand
  39. {
  40.   public:
  41.  
  42.     FW_DECLARE_AUTO(CDrawDragCommand)
  43.  
  44.     CDrawDragCommand(Environment* ev, 
  45.                      CDrawPart* part,
  46.                      FW_CFrame* frame,
  47.                      CDrawSelection* selection,
  48.                      FW_Boolean canUndo);
  49.  
  50.     virtual ~CDrawDragCommand();
  51.  
  52.     // --- FW_CCommand overrides
  53.     virtual void         UndoIt(Environment* ev);
  54.     virtual void         RedoIt(Environment* ev);
  55.     virtual void         SaveUndoState(Environment* ev);
  56.     virtual void         FreeUndoState(Environment *ev);
  57.     
  58.     virtual void          PropagateChanges(Environment* ev, ODUpdateID id = kODUnknownUpdate);
  59.     virtual void          DoIt(Environment* ev);
  60.  
  61.   protected:
  62.     CDrawPart*            fDrawPart;
  63.     CDrawSelection*        fDrawSelection;
  64.     CDrawUndoContent*    fDraggedContent;
  65.     ODShape*            fUpdateShape;
  66.     CDrawPublishLinkCollection* fLinkSources;
  67. };
  68.  
  69. //========================================================================================
  70. // class CDrawDropCommand - for dropping
  71. //========================================================================================
  72.  
  73. class CDrawDropCommand : public FW_CDropCommand
  74. {
  75.   public:
  76.   
  77.     FW_DECLARE_AUTO(CDrawDropCommand)
  78.  
  79.     CDrawDropCommand(Environment* ev, 
  80.                      CDrawPart* itsPart,
  81.                      FW_CFrame* frame,
  82.                      ODDragItemIterator* dropInfo, 
  83.                      ODFacet* facet, 
  84.                      const FW_CPoint& windowPoint,
  85.                      FW_Boolean canUndo);
  86.  
  87.     virtual ~ CDrawDropCommand();
  88.  
  89.     virtual void             UndoIt(Environment* ev);            // Override
  90.     virtual void             RedoIt(Environment* ev);            // Override
  91.     virtual void             FreeRedoState(Environment *ev);        // Override
  92.     virtual void             SaveRedoState(Environment* ev);        // Override
  93.  
  94.     // --- FW_CDropCommand overrides
  95.     virtual FW_Boolean         DoDrop(Environment* ev, 
  96.                                 ODStorageUnit* dropSU, 
  97.                                 const FW_CPoint& mouseDownOffset, 
  98.                                 const FW_CPoint& dropPoint, 
  99.                                 FW_Boolean isDropMove,
  100.                                 short itemNumber);
  101.                                 
  102.     virtual FW_Boolean        DoDroppedInSameFrame(Environment* ev, 
  103.                                 ODStorageUnit* dropSU, 
  104.                                 const FW_CPoint& mouseDownOffset, 
  105.                                 const FW_CPoint& dropPoint);
  106.                                 
  107.     virtual void             DoDroppedPasteAs(Environment* ev, 
  108.                                 const FW_CPoint& mouseDownOffset,
  109.                                 const FW_CPoint& dropPoint);
  110.     virtual void             PropagateChanges(Environment* ev, 
  111.                                 ODUpdateID id = kODUnknownUpdate);
  112.  
  113.   private:
  114.     void                     OffsetSelection(Environment* ev, const FW_CPoint& delta);
  115.     void                     RestoreDroppedShapes(Environment* ev);
  116.  
  117.     CDrawLinkManager*         GetDrawLinkManager(Environment* ev) const;
  118.  
  119.   private:
  120.     CDrawPart*                fDrawPart;
  121.     CDrawSelection*            fDrawSelection;
  122.     FW_CPoint                fDropDelta;
  123.     CDrawContent*            fDroppedContent;
  124.     CDrawSubscribeLink*        fSavedLink;
  125. };
  126.  
  127.  
  128. #endif
  129.